<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>家居家具管理系统</title>

    <!-- begin::global styles -->
    <link rel="stylesheet" href="${APP_PATH}/assets/vendors/bundle.css" type="text/css">
    <!-- end::global styles -->

    <!-- begin::datepicker -->
    <link rel="stylesheet" href="${APP_PATH}/assets/vendors/datepicker/daterangepicker.css">
    <!-- begin::datepicker -->

    <!-- begin::vmap -->
    <link rel="stylesheet" href="${APP_PATH}/assets/vendors/vmap/jqvmap.min.css">
    <!-- begin::vmap -->

    <!-- begin::custom styles -->
    <link rel="stylesheet" href="${APP_PATH}/assets/css/app.css" type="text/css">
    <link rel="stylesheet" href="${APP_PATH}/assets/css/custom.css" type="text/css">
    <!-- end::custom styles -->

</head>
<body>

<!-- begin::page loader-->
<div class="page-loader">
    <div class="spinner-border"></div>
    <span>加载中 ...</span>
</div>
<!-- end::page loader -->



<!-- begin::navigation -->
<jsp:include page="/WEB-INF/jsps/Manager/common/navigation.jsp"/>
<!-- end::navigation -->

<!-- begin::top -->
<jsp:include page="/WEB-INF/jsps/Manager/common/top.jsp"/>
<!-- end::top -->

<!-- begin::main content -->
<main class="main-content">

    <div class="container-fluid">

        <!-- begin::page header -->
        <div class="page-header d-md-flex justify-content-between align-items-center">
            <h4>首页</h4>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb m-t-0">
                    <li class="breadcrumb-item"><a href="${APP_PATH}/toManager">家居家具管理系统</a></li>
                    <li class="breadcrumb-item active" aria-current="page">首页</li>
                </ol>
            </nav>
        </div>
        <!-- end::page header -->

        <div class="row">

            <div class="col-md-4">
                <div class="card">
                    <img src="${APP_PATH}/assets/media/image/photo9.jpg" class="card-img-top" alt="...">
                    <div class="card-body text-center m-t-70-minus">
                        <figure class="avatar avatar-xl m-b-20">
                            <img src="${APP_PATH}/${sessionScope.admin.aface == null? "assets/media/image/avatar.jpg": sessionScope.admin.aface}" class="rounded-circle" alt="...">
                        </figure>
                        <h5>${sessionScope.admin.aname}</h5>
                        <p class="text-muted small">管理员</p>
                        <p>${sessionScope.admin.sign}</p>
                        <a href="${APP_PATH}/toAdminInfo" class="btn btn-outline-primary">
                            <i class="fa fa-pencil m-r-5"></i> 编辑个人信息
                        </a>
                        <div class="row m-t-30">
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-4">

                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title d-flex justify-content-between">商品销售额 <small class="text-black-50">最近一个月</small></h5>

                        <c:forEach items="${requestScope.homeInfo.salesInfoList}" var="salesInfo">
                            <div class="mb-4">
                                <div class="text-muted mb-2">
                                    <div class="icon-block icon-block-sm icon-block-floating icon-block-outline-primary text-primary m-r-10">
                                        <i class="ti ti-package"></i>
                                    </div>
                                    ${salesInfo.kinds.kname}
                                </div>
                                <div class="d-flex align-items-center">
                                    <div class="progress flex-grow-1" style=" height: 7px">
                                        <div class="progress-bar bg-info-gradient" role="progressbar" style="width: <fmt:formatNumber type="number" value="${salesInfo.kindsSales * 100 / requestScope.homeInfo.allSales}" pattern="#.#" />%;"
                                             aria-valuenow="<fmt:formatNumber type="number" value="${salesInfo.kindsSales * 100 / requestScope.homeInfo.allSales}" pattern="#.#" />" aria-valuemin="0" aria-valuemax="100"></div>
                                    </div>
                                    <span class="h6 mb-0 ml-3"><fmt:formatNumber type="number" value="${salesInfo.kindsSales * 100 / requestScope.homeInfo.allSales}" pattern="#.#" />%</span>
                                </div>
                            </div>
                        </c:forEach>

                    </div>
                </div>

                <div class="card m-b-30 bg-success-gradient">
                    <div class="card-body text-white">
                        <div class="text-center">
                            <div class="display-4 font-weight-800 p-t-20">￥<fmt:formatNumber type="number" value="${requestScope.homeInfo.allSales}" pattern="#.00" /></div>
                            <p></p>
                        </div>
                    </div>
                </div>

            </div>


            <div class="col-md-4">

                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title">最新商品</h5>
                        <div class="row">

                            <c:forEach items="${requestScope.homeInfo.newFurnitureInfos}" var="furnitureInfo">
                                <div class="col-lg-4 mb-3"><a href="${APP_PATH}/toFurniture_Detail?kid=${furnitureInfo.kid}&ktid=${furnitureInfo.furniture.kt_ktid}&fid=${furnitureInfo.furniture.fid}"><img class="img-fluid rounded" src="${APP_PATH}/${furnitureInfo.furniture.fface}" alt="image"></a></div>
                            </c:forEach>

                        </div>
                    </div>
                </div>

                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title d-flex justify-content-between">
                            新用户
                            <small class="text-black-50">最近一个月</small>
                        </h5>
                        <div class="d-flex justify-content-between align-items-center">
                            <h2 class="m-b-0 font-weight-800">${requestScope.homeInfo.NUser}</h2>
                            <div class="icon-block icon-block-xl icon-block-floating icon-block-outline-warning">
                                <i class="ti-user"></i>
                            </div>
                        </div>
                        <p class="mb-0 text-success">
                            <i class="ti-angle-up m-r-5"></i>
                            ${requestScope.homeInfo.LMUser == 0? 1000 : (requestScope.homeInfo.NUser - requestScope.homeInfo.LMUser) * 100 / requestScope.homeInfo.LMUser}%
                        </p>
                    </div>
                </div>

                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title d-flex justify-content-between">
                            盈利额
                            <small class="text-black-50">最近一个月</small>
                        </h5>
                        <div class="d-flex justify-content-between align-items-center">
                            <h2 class="m-b-0 font-weight-800">￥<fmt:formatNumber type="number" value="${requestScope.homeInfo.NProfit}" pattern="#.00" /></h2>
                            <div class="icon-block icon-block-xl icon-block-floating icon-block-outline-${(requestScope.homeInfo.NProfit - requestScope.homeInfo.LMProfit) > 0?"success" : "danger"}">
                                <i class="ti ${(requestScope.homeInfo.NProfit - requestScope.homeInfo.LMProfit) > 0?"ti-stats-up" : "ti-stats-down"}"></i>
                            </div>
                        </div>
                        <p class="mb-0 text-${(requestScope.homeInfo.NProfit - requestScope.homeInfo.LMProfit) > 0?"success":"danger"}">
                            <i class="${(requestScope.homeInfo.NProfit - requestScope.homeInfo.LMProfit) > 0?"ti-angle-up":"ti-angle-down"} m-r-5"></i>
                            <fmt:formatNumber type="number" value="${requestScope.homeInfo.LMProfit == 0 ? 1000 : (requestScope.homeInfo.NProfit - requestScope.homeInfo.LMProfit) * 100 / requestScope.homeInfo.LMProfit}" pattern="#.#" />%
                        </p>
                    </div>
                </div>
            </div>




        </div>

        <!-- begin::bottom -->
        <div class="card-group">
            <jsp:include page="/WEB-INF/jsps/Manager/common/bottom.jsp"/>
        </div>
        <!-- end::bottom -->

    </div>

</main>
<!-- end::main content -->

<!-- begin::global scripts -->
<script src="${APP_PATH}/assets/vendors/bundle.js"></script>
<!-- end::global scripts -->

<!-- begin::charts -->
<script src="${APP_PATH}/assets/vendors/charts/chartjs/chart.min.js"></script>
<script src="${APP_PATH}/assets/vendors/charts/peity/jquery.peity.min.js"></script>
<script src="${APP_PATH}/assets/js/examples/charts/chartjs.js"></script>
<script src="${APP_PATH}/assets/js/examples/charts/peity.js"></script>
<!-- end::charts -->

<!-- begin::daterangepicker -->
<script src="${APP_PATH}/assets/vendors/datepicker/daterangepicker.js"></script>
<!-- end::daterangepicker -->

<!-- begin::dashboard -->
<script src="${APP_PATH}/assets/js/examples/dashboard.js"></script>
<!-- end::dashboard -->

<!-- begin::vamp -->
<script src="${APP_PATH}/assets/vendors/vmap/jquery.vmap.min.js"></script>
<script src="${APP_PATH}/assets/vendors/vmap/maps/jquery.vmap.usa.js"></script>
<script src="${APP_PATH}/assets/js/examples/vmap.js"></script>
<!-- end::vamp -->

<!-- begin::custom scripts -->
<script src="${APP_PATH}/assets/js/custom.js"></script>
<script src="${APP_PATH}/assets/js/app.js"></script>
<!-- end::custom scripts -->
<script>

    $(function () {
        $('.page-loader').fadeOut(700, function () {

            setTimeout(function () {
                toastr.options = {
                    timeOut: 1500,
                    progressBar: true,
                    showMethod: "slideDown",
                    hideMethod: "slideUp",
                    showDuration: 200,
                    hideDuration: 200
                };

                toastr.success('欢迎回来! ${sessionScope.admin.aname}.');
            }, 800);
        }); });
</script>
</body>
</html>
